import request from '@/utils/request'

/**
 * 创建销售订单
 */
export function createOrder(data) {
  return request({
    url: '/sales/order',
    method: 'post',
    data
  })
}

/**
 * 分页查询订单
 */
export function getOrderPage(params) {
  return request({
    url: '/sales/order/page',
    method: 'get',
    params
  })
}

/**
 * 获取订单详情
 */
export function getOrderDetail(id) {
  return request({
    url: `/sales/order/${id}`,
    method: 'get'
  })
}

/**
 * 取消订单
 */
export function cancelOrder(id, data) {
  return request({
    url: `/sales/order/cancel/${id}`,
    method: 'post',
    data
  })
}

/**
 * 销售统计
 */
export function getSalesStatistics(params) {
  return request({
    url: '/sales/statistics',
    method: 'get',
    params
  })
}

/**
 * 分页查询销售日志
 */
export function getSalesLogPage(params) {
  return request({
    url: '/sales/log/page',
    method: 'get',
    params
  })
}

